<template>
    <div class="main">
        <banner></banner>
        <div class="h1">身份信息登记</div>
        <div class="login-mobile pd20">
            <div class="input-box">
                <mt-field label="真实姓名" placeholder="请输入真实姓名" type="text" v-model="realName"></mt-field>
                <mt-field label="身份证号" placeholder="请输入身份证号" type="number" v-model="idCardNo"></mt-field>
            </div>
            <!--div class="input-box">
                <mt-button type="default" size="large" @click.native="setHeadPic()">上传照片</mt-button>
            </div-->
            <mt-actionsheet
                    :actions="actions"
                    v-model="sheetVisible">
                </mt-actionsheet>
            <div class="btn-box">
                <mt-button type="primary" size="large" @click.native="register()">确认登记并排队</mt-button>
            </div>
        </div>
    </div>
</template>

<script>
import banner from '../components/banner.vue'
import { MessageBox } from 'mint-ui'
export default {
    name: 'index',

    data () {
        return {
            actions: [
                // {name: "拍照", method: "camera"},
                // {name: "相册选择", method: "album"}
            ],
            realName: '',
            idCardNo: '',
            sheetVisible:false
        }
    },

    mounted() {
        
    },
    
    methods: {
        setHeadPic () {
            if (this.sheetVisible){
                this.sheetVisible = false
            } else {
                this.sheetVisible = true
            }
        },
        /**
        * 身份登记
        */
        register () {
            this.getHeaders()
            let ts = this
            let api = this.getApi('register')
            let data = this.getFormData({'realName': this.realName, 'idCardNo': this.idCardNo})
            this.$ajax({
                method: 'POST',
                url: api,
                data: data,
                headers: this.headers,
            }).then(function(res){
                if(res.data.code == 1){
                    ts.createQue()
                }else{
                    MessageBox('提示', res.data.msg)
                }
            }).catch(function(error){
                console.log(error)
            })
        }
    },
    components: {banner}
}
</script>